﻿using Architecture.Api.Application.Commands.RoleCommand;
using Architecture.Domain.Services.Interface;
using Architecture.Domian.Entity;
using MediatR;

namespace Architecture.Api.Application.CommandHandlers.RoleHandler
{
    public class RoleReadByIdCommandHandler : IRequestHandler<RoleReadByIdCommand, RoleInfo>
    {
        private readonly IRoleSerivce _roleService;

        public RoleReadByIdCommandHandler(IRoleSerivce roleService)
        {
            _roleService = roleService;
        }

        public async Task<RoleInfo> Handle(RoleReadByIdCommand request, CancellationToken cancellationToken)
        {
            return await _roleService.GetRoleInfoByRoleId(request.RoleId);
        }
    }
}
